home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume22 / parseargs / patch08 next >
Encoding:
Text File  |  1991-08-16  |  58.0 KB  |  1,992 lines

  1. Newsgroups: comp.sources.misc
  2. From: Brad Appleton <brad@hcx1.ssd.csd.harris.com>
  3. Subject:  v22i024:  parseargs - functions to parse command line arguments, Patch08
  4. Message-ID: <1991Aug16.030500.17320@sparky.IMD.Sterling.COM>
  5. X-Md4-Signature: 2c578b5d5f1b1c4ea311d648e10d4381
  6. Date: Fri, 16 Aug 1991 03:05:00 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: Brad Appleton <brad@hcx1.ssd.csd.harris.com>
  10. Posting-number: Volume 22, Issue 24
  11. Archive-name: parseargs/patch08
  12. Environment: UNIX, VMS, MS-DOS, OS/2, Amiga
  13. Patch-To: parseargs: Volume 17, Issue 46-57
  14.  
  15. This is patch08 of parseargs. It does not change very much. 90% of the changes
  16. are in the comments. It does fix a few memory leaks in some of the lesser used
  17. functions however. The following is a more detailed description:
  18.  
  19.     - fixed some typos in the comments (SIDE-EFFECTS was misspelled
  20.       everywhere in the comments for the functions).
  21.     - fixed up external definition of ProgName to work for C++
  22.       (added extern "C").
  23.     - fixed up lparseargs() and vparseargs to free the argument vector
  24.       when it was finished with it.
  25.     - added some more comments to xparse.c and parseargs.c.
  26.  
  27. TO APPLY THIS PATCH:
  28.    1) cd to your parseargs source directory
  29.    2) unshar this file to get the file PATCH08
  30.    3) type "patch -p0 <PATCH08"
  31.  
  32. Enjoy!
  33.  _____________________ "And miles to go before I sleep." ______________________
  34.  Brad Appleton                         Harris Corp., Computer Systems Division
  35.    Software Engineer                   2101 West Cypress Creek Road,  M/S 161 
  36.      brad@ssd.csd.harris.com           Fort Lauderdale, FL  33309-1892  USA
  37.        ...!uunet!travis!brad                 Phone: (305) 973-5190
  38.  ~~~~~~~~~~~~~~~~~~~ Disclaimer: I said it, not my company! ~~~~~~~~~~~~~~~~~~~
  39.  
  40. #! /bin/sh
  41. # This is a shell archive.  Remove anything before this line, then unpack
  42. # it by saving it into a file and typing "sh file".  To overwrite existing
  43. # files, type "sh file -c".  You can also feed this as standard input via
  44. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  45. # will see the following message at the end:
  46. #        "End of shell archive."
  47. # Contents:  PATCH08
  48. # Wrapped by brad@hcx2 on Thu Aug 15 11:55:16 1991
  49. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  50. if test -f 'PATCH08' -a "${1}" != "-c" ; then 
  51.   echo shar: Will not clobber existing file \"'PATCH08'\"
  52. else
  53. echo shar: Extracting \"'PATCH08'\" \(54518 characters\)
  54. sed "s/^X//" >'PATCH08' <<'END_OF_FILE'
  55. X*** Intro.OLD    Thu Aug 15 11:46:15 1991
  56. X--- Intro    Thu Aug 15 11:05:23 1991
  57. X***************
  58. X*** 98,104 ****
  59. X  
  60. X   The VMS command-line syntax would be the following:
  61. X  
  62. X!     cmdname [/AREA[=<areacode>]] [/GROUPS=<newsgroups>[,<newsgroups>...]
  63. X              [/REP=<repcount>] [/SEP=<sepchar>] [/X]  <name>
  64. X              [<args>[,<args>...]]
  65. X  
  66. X--- 98,104 ----
  67. X  
  68. X   The VMS command-line syntax would be the following:
  69. X  
  70. X!     cmdname [/AREA[=<areacode>]] [/GROUPS=<newsgroups>[,<newsgroups>...]]
  71. X              [/REP=<repcount>] [/SEP=<sepchar>] [/X]  <name>
  72. X              [<args>[,<args>...]]
  73. X  
  74. X*** README.OLD    Thu Aug 15 11:46:40 1991
  75. X--- README    Thu Aug 15 11:06:56 1991
  76. X***************
  77. X*** 222,229 ****
  78. X  
  79. X  
  80. X               Update to parseargs (and major re-write) by Brad Appleton
  81. X!                         (brad@travis.ssd.csd.harris.com)
  82. X!                               Last Update: 04/12/91
  83. X   
  84. X  
  85. X   THIS RELEASE
  86. X--- 222,229 ----
  87. X  
  88. X  
  89. X               Update to parseargs (and major re-write) by Brad Appleton
  90. X!                         (brad@ssd.csd.harris.com)
  91. X!                               Last Update: 08/15/91
  92. X   
  93. X  
  94. X   THIS RELEASE
  95. X*** amiga_args.c.OLD    Thu Aug 15 11:46:47 1991
  96. X--- amiga_args.c    Thu Aug  1 15:45:49 1991
  97. X***************
  98. X*** 69,75 ****
  99. X  ** ^REQUIREMENTS:
  100. X  **    The final element in argv must be a NULL pointer.
  101. X  **
  102. X! ** ^SIDE-EFECTS:
  103. X  **    argd is modified according to the command-line description and parameters
  104. X  **
  105. X  ** ^RETURN-VALUE:
  106. X--- 69,75 ----
  107. X  ** ^REQUIREMENTS:
  108. X  **    The final element in argv must be a NULL pointer.
  109. X  **
  110. X! ** ^SIDE-EFFECTS:
  111. X  **    argd is modified according to the command-line description and parameters
  112. X  **
  113. X  ** ^RETURN-VALUE:
  114. X***************
  115. X*** 347,353 ****
  116. X  **    buf must be large enough to hold the formatted result (100 characters
  117. X  **    should do the trick).
  118. X  **
  119. X! ** ^SIDE-EFECTS:
  120. X  **    buf is overwritten.
  121. X  **
  122. X  ** ^RETURN-VALUE:
  123. X--- 347,353 ----
  124. X  **    buf must be large enough to hold the formatted result (100 characters
  125. X  **    should do the trick).
  126. X  **
  127. X! ** ^SIDE-EFFECTS:
  128. X  **    buf is overwritten.
  129. X  **
  130. X  ** ^RETURN-VALUE:
  131. X***************
  132. X*** 415,421 ****
  133. X  ** ^REQUIREMENTS:
  134. X  **    argd should be a non-null command-line argument-descriptor array
  135. X  **
  136. X! ** ^SIDE-EFECTS:
  137. X  **    Prints on stderr.
  138. X  **
  139. X  ** ^RETURN-VALUE:
  140. X--- 415,421 ----
  141. X  ** ^REQUIREMENTS:
  142. X  **    argd should be a non-null command-line argument-descriptor array
  143. X  **
  144. X! ** ^SIDE-EFFECTS:
  145. X  **    Prints on stderr.
  146. X  **
  147. X  ** ^RETURN-VALUE:
  148. X*** arglist.c.OLD    Thu Aug 15 11:46:54 1991
  149. X--- arglist.c    Thu Aug  1 15:45:54 1991
  150. X***************
  151. X*** 61,67 ****
  152. X  **    string-list argument. The ad_valp field of ad MUST be either NULL or
  153. X  **    point to a valid arglist-head structure.
  154. X  **
  155. X! ** ^SIDE-EFECTS:
  156. X  **    If successful, arglist pointed to by arg_valp(ad) is appended with
  157. X  **    the given string, <vp> is unchanged.
  158. X  **
  159. X--- 61,67 ----
  160. X  **    string-list argument. The ad_valp field of ad MUST be either NULL or
  161. X  **    point to a valid arglist-head structure.
  162. X  **
  163. X! ** ^SIDE-EFFECTS:
  164. X  **    If successful, arglist pointed to by arg_valp(ad) is appended with
  165. X  **    the given string, <vp> is unchanged.
  166. X  **
  167. X***************
  168. X*** 174,180 ****
  169. X  ** ^REQUIREMENTS:
  170. X  **    argls must point to a valid arglist-head structure.
  171. X  **
  172. X! ** ^SIDE-EFECTS:
  173. X  **    each item in argls is removed, argls itself should be set to NULL
  174. X  **    after this routine is invoked.
  175. X  **
  176. X--- 174,180 ----
  177. X  ** ^REQUIREMENTS:
  178. X  **    argls must point to a valid arglist-head structure.
  179. X  **
  180. X! ** ^SIDE-EFFECTS:
  181. X  **    each item in argls is removed, argls itself should be set to NULL
  182. X  **    after this routine is invoked.
  183. X  **
  184. X*** ibm_args.c.OLD    Thu Aug 15 11:50:11 1991
  185. X--- ibm_args.c    Thu Aug  1 15:46:01 1991
  186. X***************
  187. X*** 97,103 ****
  188. X  ** ^REQUIREMENTS:
  189. X  **    None.
  190. X  **
  191. X! ** ^SIDE-EFECTS:
  192. X  **    Sets the global variables "OptPrefix" and "KwdPrefix'.
  193. X  **
  194. X  ** ^RETURN-VALUE:
  195. X--- 97,103 ----
  196. X  ** ^REQUIREMENTS:
  197. X  **    None.
  198. X  **
  199. X! ** ^SIDE-EFFECTS:
  200. X  **    Sets the global variables "OptPrefix" and "KwdPrefix'.
  201. X  **
  202. X  ** ^RETURN-VALUE:
  203. X***************
  204. X*** 162,168 ****
  205. X  ** ^REQUIREMENTS:
  206. X  **    The final element in argv must be a NULL pointer.
  207. X  **
  208. X! ** ^SIDE-EFECTS:
  209. X  **    argd is modified according to the command-line description and parameters
  210. X  **
  211. X  ** ^RETURN-VALUE:
  212. X--- 162,168 ----
  213. X  ** ^REQUIREMENTS:
  214. X  **    The final element in argv must be a NULL pointer.
  215. X  **
  216. X! ** ^SIDE-EFFECTS:
  217. X  **    argd is modified according to the command-line description and parameters
  218. X  **
  219. X  ** ^RETURN-VALUE:
  220. X***************
  221. X*** 564,570 ****
  222. X  **    buf must be large enough to hold the formatted result (100 characters
  223. X  **    should do the trick).
  224. X  **
  225. X! ** ^SIDE-EFECTS:
  226. X  **    buf is overwritten.
  227. X  **
  228. X  ** ^RETURN-VALUE:
  229. X--- 564,570 ----
  230. X  **    buf must be large enough to hold the formatted result (100 characters
  231. X  **    should do the trick).
  232. X  **
  233. X! ** ^SIDE-EFFECTS:
  234. X  **    buf is overwritten.
  235. X  **
  236. X  ** ^RETURN-VALUE:
  237. X***************
  238. X*** 658,664 ****
  239. X  ** ^REQUIREMENTS:
  240. X  **    argd should be a non-null command-line argument-descriptor array
  241. X  **
  242. X! ** ^SIDE-EFECTS:
  243. X  **    Prints on stderr.
  244. X  **
  245. X  ** ^RETURN-VALUE:
  246. X--- 658,664 ----
  247. X  ** ^REQUIREMENTS:
  248. X  **    argd should be a non-null command-line argument-descriptor array
  249. X  **
  250. X! ** ^SIDE-EFFECTS:
  251. X  **    Prints on stderr.
  252. X  **
  253. X  ** ^RETURN-VALUE:
  254. X*** parseargs.c.OLD    Thu Aug 15 11:50:26 1991
  255. X--- parseargs.c    Thu Aug 15 10:56:52 1991
  256. X***************
  257. X*** 244,256 ****
  258. X     /* array of shell info records for supported shells */
  259. X  static CONST shell_info  Shell[] = {
  260. X     {
  261. X        SH,  "sh",
  262. X!       "shift $#;\n",  
  263. X        "%s=",  "'",  "';\n",
  264. X        "%s=",  "'",  "'%s'",  "';\n",
  265. X!       "'\\%c'",  "'"
  266. X     },
  267. X     {
  268. X        BASH,  "bash",
  269. X        "shift $#;\n",  
  270. X        "%s=",  "'",  "';\n",
  271. X--- 244,270 ----
  272. X     /* array of shell info records for supported shells */
  273. X  static CONST shell_info  Shell[] = {
  274. X     {
  275. X+          /* Bourne Shell */
  276. X        SH,  "sh",
  277. X! 
  278. X!          /* "shift $#" unsets the positional parameters */
  279. X!       "shift $#;\n",
  280. X! 
  281. X!          /* "name='value'" assigns "value" to the variable "name" */
  282. X        "%s=",  "'",  "';\n",
  283. X+ 
  284. X+          /* "ary='elt1 elt2 ...'" assigns an array named "ary" */
  285. X        "%s=",  "'",  "'%s'",  "';\n",
  286. X! 
  287. X!          /* the only character we need to escape is a "'", We do this by ending
  288. X!          ** the current quote, escaping the quote, and starting a new one
  289. X!          */
  290. X!       "'\\%c'",  "'"                    
  291. X     },
  292. X     {
  293. X+          /* Bourne-Again shell -- we treat it the same as the Bourne shell.
  294. X+          ** (this should change when BASH supports arrays)
  295. X+          */
  296. X        BASH,  "bash",
  297. X        "shift $#;\n",  
  298. X        "%s=",  "'",  "';\n",
  299. X***************
  300. X*** 258,298 ****
  301. X--- 272,380 ----
  302. X        "'\\%c'",  "'"
  303. X     },
  304. X     {
  305. X+          /* Korn Shell */
  306. X        KSH,  "ksh",
  307. X+ 
  308. X+          /* "set -- ;" unsets the positional parameters */
  309. X        "set --;\n",  
  310. X+ 
  311. X+          /* "name='value'" assigns "value" to the variable "name" */
  312. X        "%s=",  "'",  "';\n",
  313. X+ 
  314. X+          /* "set [-+]A ary 'elt1' 'elt2' ..." assigns an array named "ary" */
  315. X        "set %cA %s ",  "'",  "'%s'",  "';\n",
  316. X+ 
  317. X+          /* the only character we need to escape is a "'", We do this by ending
  318. X+          ** the current quote, escaping the quote, and starting a new one
  319. X+          */
  320. X        "'\\%c'",  "'"
  321. X     },
  322. X     {
  323. X+          /* C-Shell */
  324. X        CSH,  "csh",
  325. X+ 
  326. X+          /* "set argv=()" unsets the positional parameters */
  327. X        "set argv=();\n",  
  328. X+ 
  329. X+          /* "set name='value'" assigns "value" to the variable "name" */
  330. X        "set %s=",  "'",  "';\n",
  331. X+ 
  332. X+          /* "set ary=( 'elt1' 'elt2' ... )" assigns an array named "ary" */
  333. X        "set %s=",  "( '",  "'%s'",  "' );\n",
  334. X+ 
  335. X+          /* the only character we need to escape is a "'", We do this by ending
  336. X+          ** the current quote, escaping the quote, and starting a new one
  337. X+          */
  338. X        "'\\%c'",  "'"
  339. X     },
  340. X     {
  341. X+          /* Z-Shell -- this is a lot like the C-Shell except we dont need
  342. X+          ** the 'set' keyword when assigning variables and arrays
  343. X+          */
  344. X        ZSH,  "zsh",
  345. X+ 
  346. X+          /* "argv=()" unsets the positional parameters */
  347. X        "argv=();\n",  
  348. X+ 
  349. X+          /* "name='value'" assigns "value" to the variable "name" */
  350. X        "%s=",  "'",  "';\n",
  351. X+ 
  352. X+          /* "ary=( 'elt1' 'elt2' ... )" assigns an array named "ary" */
  353. X        "%s=",  "( '",  "'%s'",  "' );\n",
  354. X+ 
  355. X+          /* the only character we need to escape is a "'", We do this by ending
  356. X+          ** the current quote, escaping the quote, and starting a new one
  357. X+          */
  358. X        "'\\%c'",  "'"
  359. X     },
  360. X     {
  361. X+          /* rc -- the Plan 9 shell designed by Tom Duff */
  362. X        RC,  "rc",
  363. X+ 
  364. X+          /* "*=()" unsets the positional parameters */
  365. X        "*=();\n",  
  366. X+ 
  367. X+          /* "name='value'" assigns "value" to the variable "name" */
  368. X        "%s=",  "'",  "';\n",
  369. X+ 
  370. X+          /* "ary=( 'elt1' 'elt2' ... )" assigns an array named "ary" */
  371. X        "%s=",  "( '",  "'%s'",  "' );\n",
  372. X+ 
  373. X+          /* the only character to escape is a "'", We do this by using
  374. X+          ** two "'" characters in a row.
  375. X+          */
  376. X        "''",  "'"
  377. X     },
  378. X     {
  379. X+          /* perl - Larry Wall's Practical Extraction and Reoprt Language */
  380. X        PERL,  "perl",
  381. X+ 
  382. X+          /* "@ARGV = ()" unsets the positional parameters */
  383. X        "@ARGV = ();\n",  
  384. X+ 
  385. X+          /* "$name = 'value' ;" assigns "value" to the variable "name" */
  386. X        "$%s = ",  "'",  "';\n",
  387. X+ 
  388. X+          /* "@ary = ( 'elt1', 'elt2', ... );" assigns an array named "ary" */
  389. X        "@%s = ",  "( '",  "', '",  "' );\n",
  390. X+ 
  391. X+          /* the only character to escape is a "'", We do this by preceding it
  392. X+          ** with a backslash.
  393. X+          */
  394. X        "\\%c",  "'"
  395. X     },
  396. X     {
  397. X+          /* awk -- Aho, Weinberger, & Kernighan's pattern-action language
  398. X+          **
  399. X+          ** we treat awk differently then the other shells. This is because
  400. X+          ** we cant use actual awk syntax (since awk doesnt have the equivalent
  401. X+          ** of an 'eval' command). Instead, we write out an input stream for
  402. X+          ** consisting or variable assignments. Records are multi-line, and
  403. X+          ** separated by a blank line. Fields are separated by a newline. 
  404. X+          ** The first field is the name of the variable and the remaining
  405. X+          ** fields (if more than one remains we have an array) of the values
  406. X+          ** associated with the variable.
  407. X+          */
  408. X        AWK,  "awk",
  409. X        "ARGV\n\n",  
  410. X        "%s\n",  "",  "\n\n",
  411. X***************
  412. X*** 352,357 ****
  413. X--- 434,445 ----
  414. X  
  415. X  /*************************************************************************/
  416. X  
  417. X+ /*
  418. X+ ** argVers() -- This is the function used to print the version of parseargs
  419. X+ **              on standard output and then exit (regardless of where its
  420. X+ **              corresponding '-#' appears on the command line and regardless
  421. X+ **              of what may have preceded it).
  422. X+ */
  423. X  /*ARGSUSED*/
  424. X  #ifdef __ANSI_C__
  425. X     static BOOL argVers( register ARGDESC *ad,  register char *vp,  BOOL copyf )
  426. X***************
  427. X*** 504,510 ****
  428. X  ** ^REQUIREMENTS:
  429. X  **    None.
  430. X  **
  431. X! ** ^SIDE-EFECTS:
  432. X  **    Storage associated with all dynamically allocated arg-vectors
  433. X  **    is released and set to NULL.
  434. X  **
  435. X--- 592,598 ----
  436. X  ** ^REQUIREMENTS:
  437. X  **    None.
  438. X  **
  439. X! ** ^SIDE-EFFECTS:
  440. X  **    Storage associated with all dynamically allocated arg-vectors
  441. X  **    is released and set to NULL.
  442. X  **
  443. X***************
  444. X*** 559,565 ****
  445. X  ** ^REQUIREMENTS:
  446. X  **    None.
  447. X  **
  448. X! ** ^SIDE-EFECTS:
  449. X  **    Storage associated with all dynamically allocated global-variables
  450. X  **    is released and set to NULL.
  451. X  **
  452. X--- 647,653 ----
  453. X  ** ^REQUIREMENTS:
  454. X  **    None.
  455. X  **
  456. X! ** ^SIDE-EFFECTS:
  457. X  **    Storage associated with all dynamically allocated global-variables
  458. X  **    is released and set to NULL.
  459. X  **
  460. X***************
  461. X*** 614,620 ****
  462. X  ** ^REQUIREMENTS:
  463. X  **    size should be > 0
  464. X  **
  465. X! ** ^SIDE-EFECTS:
  466. X  **    Memory is allocated that should later be deallocated using free().
  467. X  **
  468. X  ** ^RETURN-VALUE:
  469. X--- 702,708 ----
  470. X  ** ^REQUIREMENTS:
  471. X  **    size should be > 0
  472. X  **
  473. X! ** ^SIDE-EFFECTS:
  474. X  **    Memory is allocated that should later be deallocated using free().
  475. X  **
  476. X  ** ^RETURN-VALUE:
  477. X***************
  478. X*** 667,673 ****
  479. X  ** ^REQUIREMENTS:
  480. X  **    size should be > 0
  481. X  **
  482. X! ** ^SIDE-EFECTS:
  483. X  **    Memory is allocated that should later be deallocated using free().
  484. X  **
  485. X  ** ^RETURN-VALUE:
  486. X--- 755,761 ----
  487. X  ** ^REQUIREMENTS:
  488. X  **    size should be > 0
  489. X  **
  490. X! ** ^SIDE-EFFECTS:
  491. X  **    Memory is allocated that should later be deallocated using free().
  492. X  **
  493. X  ** ^RETURN-VALUE:
  494. X***************
  495. X*** 721,727 ****
  496. X  **    Both <ch> and <esc> should be non-zero.
  497. X  **    <str> should be non-null and non-empty.
  498. X  **
  499. X! ** ^SIDE-EFECTS:
  500. X  **    Each occurrence in <str> of <ch> within single or double quotes is
  501. X  **    replaced with <esc>.
  502. X  **
  503. X--- 809,815 ----
  504. X  **    Both <ch> and <esc> should be non-zero.
  505. X  **    <str> should be non-null and non-empty.
  506. X  **
  507. X! ** ^SIDE-EFFECTS:
  508. X  **    Each occurrence in <str> of <ch> within single or double quotes is
  509. X  **    replaced with <esc>.
  510. X  **
  511. X***************
  512. X*** 781,787 ****
  513. X  **    It should be noted that escape_char() only replaces characters in quotes
  514. X  **    whereas this routine replaces all occurrences.
  515. X  **
  516. X! ** ^SIDE-EFECTS:
  517. X  **    Each occurrence of <esc> in <str> is replaced with <ch>.
  518. X  **
  519. X  ** ^RETURN-VALUE:
  520. X--- 869,875 ----
  521. X  **    It should be noted that escape_char() only replaces characters in quotes
  522. X  **    whereas this routine replaces all occurrences.
  523. X  **
  524. X! ** ^SIDE-EFFECTS:
  525. X  **    Each occurrence of <esc> in <str> is replaced with <ch>.
  526. X  **
  527. X  ** ^RETURN-VALUE:
  528. X***************
  529. X*** 823,829 ****
  530. X  ** ^REQUIREMENTS:
  531. X  **    type_str should be non-NULL and non-empty
  532. X  **
  533. X! ** ^SIDE-EFECTS:
  534. X  **    None.
  535. X  **
  536. X  ** ^RETURN-VALUE:
  537. X--- 911,917 ----
  538. X  ** ^REQUIREMENTS:
  539. X  **    type_str should be non-NULL and non-empty
  540. X  **
  541. X! ** ^SIDE-EFFECTS:
  542. X  **    None.
  543. X  **
  544. X  ** ^RETURN-VALUE:
  545. X***************
  546. X*** 901,907 ****
  547. X  ** ^REQUIREMENTS:
  548. X  **    flag_str should be non-NULL and non-empty
  549. X  **
  550. X! ** ^SIDE-EFECTS:
  551. X  **    None.
  552. X  **
  553. X  ** ^RETURN-VALUE:
  554. X--- 989,995 ----
  555. X  ** ^REQUIREMENTS:
  556. X  **    flag_str should be non-NULL and non-empty
  557. X  **
  558. X! ** ^SIDE-EFFECTS:
  559. X  **    None.
  560. X  **
  561. X  ** ^RETURN-VALUE:
  562. X***************
  563. X*** 960,966 ****
  564. X  ** ^REQUIREMENTS:
  565. X  **    Standard input should be open for reading and be non-interactive.
  566. X  **
  567. X! ** ^SIDE-EFECTS:
  568. X  **    Memory is allocated that should later be deallocated using free.
  569. X  **
  570. X  ** ^RETURN-VALUE:
  571. X--- 1048,1054 ----
  572. X  ** ^REQUIREMENTS:
  573. X  **    Standard input should be open for reading and be non-interactive.
  574. X  **
  575. X! ** ^SIDE-EFFECTS:
  576. X  **    Memory is allocated that should later be deallocated using free.
  577. X  **
  578. X  ** ^RETURN-VALUE:
  579. X***************
  580. X*** 1078,1084 ****
  581. X  ** ^REQUIREMENTS:
  582. X  **    sh_str should be non-NULL and non-empty.
  583. X  **
  584. X! ** ^SIDE-EFECTS:
  585. X  **    None.
  586. X  **
  587. X  ** ^RETURN-VALUE:
  588. X--- 1166,1172 ----
  589. X  ** ^REQUIREMENTS:
  590. X  **    sh_str should be non-NULL and non-empty.
  591. X  **
  592. X! ** ^SIDE-EFFECTS:
  593. X  **    None.
  594. X  **
  595. X  ** ^RETURN-VALUE:
  596. X***************
  597. X*** 1141,1147 ****
  598. X  ** ^REQUIREMENTS:
  599. X  **    argd_str should be non-NULL and non-empty
  600. X  **
  601. X! ** ^SIDE-EFECTS:
  602. X  **    The global variables UsrVals and UsrArgd are allocated and initialized
  603. X  **
  604. X  ** ^RETURN-VALUE:
  605. X--- 1229,1235 ----
  606. X  ** ^REQUIREMENTS:
  607. X  **    argd_str should be non-NULL and non-empty
  608. X  **
  609. X! ** ^SIDE-EFFECTS:
  610. X  **    The global variables UsrVals and UsrArgd are allocated and initialized
  611. X  **
  612. X  ** ^RETURN-VALUE:
  613. X***************
  614. X*** 1357,1363 ****
  615. X  **    <fp> should be non-NULL and open for writing.
  616. X  **    <ch> should be a printable character.
  617. X  **
  618. X! ** ^SIDE-EFECTS:
  619. X  **    output is written to <fp>.
  620. X  **
  621. X  ** ^RETURN-VALUE:
  622. X--- 1445,1451 ----
  623. X  **    <fp> should be non-NULL and open for writing.
  624. X  **    <ch> should be a printable character.
  625. X  **
  626. X! ** ^SIDE-EFFECTS:
  627. X  **    output is written to <fp>.
  628. X  **
  629. X  ** ^RETURN-VALUE:
  630. X***************
  631. X*** 1416,1422 ****
  632. X  **    <fp> should be non-NULL and open for writing.
  633. X  **    <str> should be non-NULL and non-empty.
  634. X  **
  635. X! ** ^SIDE-EFECTS:
  636. X  **    Output is written to <fp>
  637. X  **
  638. X  ** ^RETURN-VALUE:
  639. X--- 1504,1510 ----
  640. X  **    <fp> should be non-NULL and open for writing.
  641. X  **    <str> should be non-NULL and non-empty.
  642. X  **
  643. X! ** ^SIDE-EFFECTS:
  644. X  **    Output is written to <fp>
  645. X  **
  646. X  ** ^RETURN-VALUE:
  647. X***************
  648. X*** 1470,1476 ****
  649. X  ** ^REQUIREMENTS:
  650. X  **    <val> should be the value corresponing to the argument-descriptor <ad>
  651. X  **
  652. X! ** ^SIDE-EFECTS:
  653. X  **    Output is written to <fp>.
  654. X  **
  655. X  ** ^RETURN-VALUE:
  656. X--- 1558,1564 ----
  657. X  ** ^REQUIREMENTS:
  658. X  **    <val> should be the value corresponing to the argument-descriptor <ad>
  659. X  **
  660. X! ** ^SIDE-EFFECTS:
  661. X  **    Output is written to <fp>.
  662. X  **
  663. X  ** ^RETURN-VALUE:
  664. X***************
  665. X*** 1732,1738 ****
  666. X  ** ^REQUIREMENTS:
  667. X  **    <val> should correspond to the vlue of the argument indicated by <ad>
  668. X  **
  669. X! ** ^SIDE-EFECTS:
  670. X  **    prints the array assignment statement on standard output
  671. X  **
  672. X  ** ^RETURN-VALUE:
  673. X--- 1820,1826 ----
  674. X  ** ^REQUIREMENTS:
  675. X  **    <val> should correspond to the vlue of the argument indicated by <ad>
  676. X  **
  677. X! ** ^SIDE-EFFECTS:
  678. X  **    prints the array assignment statement on standard output
  679. X  **
  680. X  ** ^RETURN-VALUE:
  681. X***************
  682. X*** 1825,1831 ****
  683. X  **    The argument values have already been set due to the fact that parseargs
  684. X  **    should already have been invoked to parse the command-line
  685. X  **
  686. X! ** ^SIDE-EFECTS:
  687. X  **    Variable assignment statements are printed on standard output.
  688. X  **
  689. X  ** ^RETURN-VALUE:
  690. X--- 1913,1919 ----
  691. X  **    The argument values have already been set due to the fact that parseargs
  692. X  **    should already have been invoked to parse the command-line
  693. X  **
  694. X! ** ^SIDE-EFFECTS:
  695. X  **    Variable assignment statements are printed on standard output.
  696. X  **
  697. X  ** ^RETURN-VALUE:
  698. X***************
  699. X*** 1926,1932 ****
  700. X  ** ^REQUIREMENTS:
  701. X  **    The currenty shell-type has already been determined.
  702. X  **
  703. X! ** ^SIDE-EFECTS:
  704. X  **    Prints on stdout.
  705. X  **
  706. X  ** ^RETURN-VALUE:
  707. X--- 2014,2020 ----
  708. X  ** ^REQUIREMENTS:
  709. X  **    The currenty shell-type has already been determined.
  710. X  **
  711. X! ** ^SIDE-EFFECTS:
  712. X  **    Prints on stdout.
  713. X  **
  714. X  ** ^RETURN-VALUE:
  715. X***************
  716. X*** 1962,1968 ****
  717. X  ** ^REQUIREMENTS:
  718. X  **    The command-line should already have been parsed by parseargs(3)
  719. X  **
  720. X! ** ^SIDE-EFECTS:
  721. X  **    - Exits the program if an error is encountered.
  722. X  **    - Assigns any needed defaults for StrTrue and StrFalse.
  723. X  **    - Gets the argd-string from an environment variable if needed
  724. X--- 2050,2056 ----
  725. X  ** ^REQUIREMENTS:
  726. X  **    The command-line should already have been parsed by parseargs(3)
  727. X  **
  728. X! ** ^SIDE-EFFECTS:
  729. X  **    - Exits the program if an error is encountered.
  730. X  **    - Assigns any needed defaults for StrTrue and StrFalse.
  731. X  **    - Gets the argd-string from an environment variable if needed
  732. X*** parseargs.h.OLD    Thu Aug 15 11:50:41 1991
  733. X--- parseargs.h    Thu Aug  1 15:47:32 1991
  734. X***************
  735. X*** 1011,1017 ****
  736. X     EXTERN int   parsecntl   ARGS(( ARGDESC *, parsecntl_t, parsemode_t, ...));
  737. X     EXTERN VOID  usage       ARGS(( const ARGDESC * ));
  738. X     EXTERN VOID  init_args   ARGS(( ARGDESC * ));
  739. X!    extern CONST char *ProgName;
  740. X  #endif  /* PARSEARGS_NEXTERNS */
  741. X  
  742. X  #endif  /* PARSEARGS_H */
  743. X--- 1011,1017 ----
  744. X     EXTERN int   parsecntl   ARGS(( ARGDESC *, parsecntl_t, parsemode_t, ...));
  745. X     EXTERN VOID  usage       ARGS(( const ARGDESC * ));
  746. X     EXTERN VOID  init_args   ARGS(( ARGDESC * ));
  747. X!    EXTERN CONST char *ProgName;
  748. X  #endif  /* PARSEARGS_NEXTERNS */
  749. X  
  750. X  #endif  /* PARSEARGS_H */
  751. X*** patchlevel.h.OLD    Thu Aug 15 11:50:53 1991
  752. X--- patchlevel.h    Thu Aug 15 10:57:37 1991
  753. X***************
  754. X*** 2,7 ****
  755. X--- 2,17 ----
  756. X  ** ^FILE: patchlevel.h - current patchlevel for parseargs
  757. X  **
  758. X  ** ^HISTORY:
  759. X+ **    08/15/91    Brad Appleton    <brad@ssd.csd.harris.com>
  760. X+ **    Patch08
  761. X+ **    - fixed some typos in the comments (SIDE-EFFECTS was misspelled
  762. X+ **      everywhere in the comments for the functions).
  763. X+ **    - fixed up external definition of ProgName to work for C++
  764. X+ **      (added extern "C").
  765. X+ **    - fixed up lparseargs() and vparseargs to free the argument vector
  766. X+ **      when it was finished with it.
  767. X+ **    - added some more comments to xparse.c and parseargs.c.
  768. X+ **
  769. X  **    06/05/91    Brad Appleton    <brad@ssd.csd.harris.com>
  770. X  **    Patch07
  771. X  **    - fixed the "Intro" file to correctly show how to invoke parseargs(3)
  772. X***************
  773. X*** 91,97 ****
  774. X  
  775. X  #define  VERSION     2
  776. X  #define  REVISION    0
  777. X! #define  PATCHLEVEL  7
  778. X  
  779. X  #ifdef __STDC__
  780. X     static const char
  781. X--- 101,107 ----
  782. X  
  783. X  #define  VERSION     2
  784. X  #define  REVISION    0
  785. X! #define  PATCHLEVEL  8
  786. X  
  787. X  #ifdef __STDC__
  788. X     static const char
  789. X***************
  790. X*** 98,101 ****
  791. X  #else
  792. X     static char
  793. X  #endif
  794. X!    _Ident[] = "@(#)parseargs  2.0  patchlevel 7";
  795. X--- 108,111 ----
  796. X  #else
  797. X     static char
  798. X  #endif
  799. X!    _Ident[] = "@(#)parseargs  2.0  patchlevel 8";
  800. X*** pgopen.c.OLD    Thu Aug 15 11:50:58 1991
  801. X--- pgopen.c    Thu Aug  1 15:46:13 1991
  802. X***************
  803. X*** 104,110 ****
  804. X  **    pgopen() must first be called in order to obtain a valid
  805. X  **    pager-file-pointer.
  806. X  **
  807. X! ** ^SIDE-EFECTS:
  808. X  **    None.
  809. X  **
  810. X  ** ^RETURN-VALUE:
  811. X--- 104,110 ----
  812. X  **    pgopen() must first be called in order to obtain a valid
  813. X  **    pager-file-pointer.
  814. X  **
  815. X! ** ^SIDE-EFFECTS:
  816. X  **    None.
  817. X  **
  818. X  ** ^RETURN-VALUE:
  819. X***************
  820. X*** 143,149 ****
  821. X  **    pgopen() must first be called in order to obtain a valid
  822. X  **    pager-file-pointer.
  823. X  **
  824. X! ** ^SIDE-EFECTS:
  825. X  **    None.
  826. X  **
  827. X  ** ^RETURN-VALUE:
  828. X--- 143,149 ----
  829. X  **    pgopen() must first be called in order to obtain a valid
  830. X  **    pager-file-pointer.
  831. X  **
  832. X! ** ^SIDE-EFFECTS:
  833. X  **    None.
  834. X  **
  835. X  ** ^RETURN-VALUE:
  836. X***************
  837. X*** 213,219 ****
  838. X  **    program which reads from standard input and writes (one screenful
  839. X  **    at a time) to the terminal.
  840. X  **
  841. X! ** ^SIDE-EFECTS:
  842. X  **    If popen() succeeds, the SIGPIPE signal is trapped.
  843. X  **
  844. X  ** ^RETURN-VALUE:
  845. X--- 213,219 ----
  846. X  **    program which reads from standard input and writes (one screenful
  847. X  **    at a time) to the terminal.
  848. X  **
  849. X! ** ^SIDE-EFFECTS:
  850. X  **    If popen() succeeds, the SIGPIPE signal is trapped.
  851. X  **
  852. X  ** ^RETURN-VALUE:
  853. X***************
  854. X*** 346,352 ****
  855. X  **    Pgopen must place the address of the desired recovery point in
  856. X  **    pg_recover.
  857. X  **
  858. X! ** ^SIDE-EFECTS:
  859. X  **    Resets SIGPIPE signal-handler and performs a non-local goto.
  860. X  **
  861. X  ** ^RETURN-VALUE:
  862. X--- 346,352 ----
  863. X  **    Pgopen must place the address of the desired recovery point in
  864. X  **    pg_recover.
  865. X  **
  866. X! ** ^SIDE-EFFECTS:
  867. X  **    Resets SIGPIPE signal-handler and performs a non-local goto.
  868. X  **
  869. X  ** ^RETURN-VALUE:
  870. X***************
  871. X*** 387,393 ****
  872. X  **    pager_cmd must be non-null and be large enough to hold any of the
  873. X  **    possible pager program-names to be opened.
  874. X  **
  875. X! ** ^SIDE-EFECTS:
  876. X  **    pager_cmd is over-written with the name of the pager-command to
  877. X  **    try to open for output
  878. X  **
  879. X--- 387,393 ----
  880. X  **    pager_cmd must be non-null and be large enough to hold any of the
  881. X  **    possible pager program-names to be opened.
  882. X  **
  883. X! ** ^SIDE-EFFECTS:
  884. X  **    pager_cmd is over-written with the name of the pager-command to
  885. X  **    try to open for output
  886. X  **
  887. X*** stest.c.OLD    Thu Aug 15 11:51:11 1991
  888. X--- stest.c    Thu Aug  1 15:46:18 1991
  889. X***************
  890. X*** 181,187 ****
  891. X  ** ^REQUIREMENTS:
  892. X  **    None.
  893. X  **
  894. X! ** ^SIDE-EFECTS:
  895. X  **    All the static-global argument variables are rewritten.
  896. X  **
  897. X  ** ^RETURN-VALUE:
  898. X--- 181,187 ----
  899. X  ** ^REQUIREMENTS:
  900. X  **    None.
  901. X  **
  902. X! ** ^SIDE-EFFECTS:
  903. X  **    All the static-global argument variables are rewritten.
  904. X  **
  905. X  ** ^RETURN-VALUE:
  906. X***************
  907. X*** 233,239 ****
  908. X  **    The command-line should have already been parsed by one of the
  909. X  **    Xparseargs functions.
  910. X  **
  911. X! ** ^SIDE-EFECTS:
  912. X  **    Prints on stdout.
  913. X  **
  914. X  ** ^RETURN-VALUE:
  915. X--- 233,239 ----
  916. X  **    The command-line should have already been parsed by one of the
  917. X  **    Xparseargs functions.
  918. X  **
  919. X! ** ^SIDE-EFFECTS:
  920. X  **    Prints on stdout.
  921. X  **
  922. X  ** ^RETURN-VALUE:
  923. X*** strfuncs.c.OLD    Thu Aug 15 11:51:18 1991
  924. X--- strfuncs.c    Thu Aug  1 15:46:24 1991
  925. X***************
  926. X*** 80,86 ****
  927. X  ** ^REQUIREMENTS:
  928. X  **    Dest must be non-null, and large enough to hold the copied result.
  929. X  **
  930. X! ** ^SIDE-EFECTS:
  931. X  **    Dest is (re)written
  932. X  **
  933. X  ** ^RETURN-VALUE:
  934. X--- 80,86 ----
  935. X  ** ^REQUIREMENTS:
  936. X  **    Dest must be non-null, and large enough to hold the copied result.
  937. X  **
  938. X! ** ^SIDE-EFFECTS:
  939. X  **    Dest is (re)written
  940. X  **
  941. X  ** ^RETURN-VALUE:
  942. X***************
  943. X*** 147,153 ****
  944. X  ** ^REQUIREMENTS:
  945. X  **    str should be non-null and non-empty.
  946. X  **
  947. X! ** ^SIDE-EFECTS:
  948. X  **    str is overwritten with the uppercase (lowercase) result.
  949. X  **
  950. X  ** ^RETURN-VALUE:
  951. X--- 147,153 ----
  952. X  ** ^REQUIREMENTS:
  953. X  **    str should be non-null and non-empty.
  954. X  **
  955. X! ** ^SIDE-EFFECTS:
  956. X  **    str is overwritten with the uppercase (lowercase) result.
  957. X  **
  958. X  ** ^RETURN-VALUE:
  959. X***************
  960. X*** 212,218 ****
  961. X  ** ^REQUIREMENTS:
  962. X  **    Both s1 and s2 should be non-null and non-empty
  963. X  **
  964. X! ** ^SIDE-EFECTS:
  965. X  **    None.
  966. X  **
  967. X  ** ^RETURN-VALUE:
  968. X--- 212,218 ----
  969. X  ** ^REQUIREMENTS:
  970. X  **    Both s1 and s2 should be non-null and non-empty
  971. X  **
  972. X! ** ^SIDE-EFFECTS:
  973. X  **    None.
  974. X  **
  975. X  ** ^RETURN-VALUE:
  976. X***************
  977. X*** 344,350 ****
  978. X  ** ^REQUIREMENTS:
  979. X  **    Both str1 and str2 should be non-null and non-empty
  980. X  **
  981. X! ** ^SIDE-EFECTS:
  982. X  **    None.
  983. X  **
  984. X  ** ^RETURN-VALUE:
  985. X--- 344,350 ----
  986. X  ** ^REQUIREMENTS:
  987. X  **    Both str1 and str2 should be non-null and non-empty
  988. X  **
  989. X! ** ^SIDE-EFFECTS:
  990. X  **    None.
  991. X  **
  992. X  ** ^RETURN-VALUE:
  993. X***************
  994. X*** 394,400 ****
  995. X  ** ^REQUIREMENTS:
  996. X  **    Both str1 and str2 should be non-null and non-empty.
  997. X  **
  998. X! ** ^SIDE-EFECTS:
  999. X  **    None.
  1000. X  **
  1001. X  ** ^RETURN-VALUE:
  1002. X--- 394,400 ----
  1003. X  ** ^REQUIREMENTS:
  1004. X  **    Both str1 and str2 should be non-null and non-empty.
  1005. X  **
  1006. X! ** ^SIDE-EFFECTS:
  1007. X  **    None.
  1008. X  **
  1009. X  ** ^RETURN-VALUE:
  1010. X***************
  1011. X*** 477,483 ****
  1012. X  ** ^REQUIREMENTS:
  1013. X  **    str should be non-null and non-empty.
  1014. X  **
  1015. X! ** ^SIDE-EFECTS:
  1016. X  **    characters may be removed from the beginning and/or end of str.
  1017. X  **
  1018. X  ** ^RETURN-VALUE:
  1019. X--- 477,483 ----
  1020. X  ** ^REQUIREMENTS:
  1021. X  **    str should be non-null and non-empty.
  1022. X  **
  1023. X! ** ^SIDE-EFFECTS:
  1024. X  **    characters may be removed from the beginning and/or end of str.
  1025. X  **
  1026. X  ** ^RETURN-VALUE:
  1027. X***************
  1028. X*** 584,590 ****
  1029. X  **    vec must be non-NULL (it must be a valid address).
  1030. X  **    token_str should be non-null and non-empty
  1031. X  **
  1032. X! ** ^SIDE-EFECTS:
  1033. X  **    All leading and trailing characters from <separators> are removed
  1034. X  **    from token_str. Furthermore, all remaining sequences in token_str
  1035. X  **    of characters from <separators> are replaced with a single NUL-byte.
  1036. X--- 584,590 ----
  1037. X  **    vec must be non-NULL (it must be a valid address).
  1038. X  **    token_str should be non-null and non-empty
  1039. X  **
  1040. X! ** ^SIDE-EFFECTS:
  1041. X  **    All leading and trailing characters from <separators> are removed
  1042. X  **    from token_str. Furthermore, all remaining sequences in token_str
  1043. X  **    of characters from <separators> are replaced with a single NUL-byte.
  1044. X***************
  1045. X*** 693,699 ****
  1046. X  **    argv must be non-NULL (it must be a valid address), and must be
  1047. X  **    terminated by a pointer to NULL (argv[last+1] == NULL).
  1048. X  **
  1049. X! ** ^SIDE-EFECTS:
  1050. X  **    Storage is allocated.
  1051. X  **
  1052. X  ** ^RETURN-VALUE:
  1053. X--- 693,699 ----
  1054. X  **    argv must be non-NULL (it must be a valid address), and must be
  1055. X  **    terminated by a pointer to NULL (argv[last+1] == NULL).
  1056. X  **
  1057. X! ** ^SIDE-EFFECTS:
  1058. X  **    Storage is allocated.
  1059. X  **
  1060. X  ** ^RETURN-VALUE:
  1061. X***************
  1062. X*** 773,779 ****
  1063. X  **    Both s and buf must be non-null and non-empty.
  1064. X  **    buf must be large enough to hold the result.
  1065. X  **
  1066. X! ** ^SIDE-EFECTS:
  1067. X  **    buf is overwritten.
  1068. X  **
  1069. X  ** ^RETURN-VALUE:
  1070. X--- 773,779 ----
  1071. X  **    Both s and buf must be non-null and non-empty.
  1072. X  **    buf must be large enough to hold the result.
  1073. X  **
  1074. X! ** ^SIDE-EFFECTS:
  1075. X  **    buf is overwritten.
  1076. X  **
  1077. X  ** ^RETURN-VALUE:
  1078. X***************
  1079. X*** 834,840 ****
  1080. X  **    Both s and buf must be non-null and non-empty.
  1081. X  **    buf must be large enough to hold the result.
  1082. X  **
  1083. X! ** ^SIDE-EFECTS:
  1084. X  **    buf is overwritten.
  1085. X  *
  1086. X  ** ^RETURN-VALUE:
  1087. X--- 834,840 ----
  1088. X  **    Both s and buf must be non-null and non-empty.
  1089. X  **    buf must be large enough to hold the result.
  1090. X  **
  1091. X! ** ^SIDE-EFFECTS:
  1092. X  **    buf is overwritten.
  1093. X  *
  1094. X  ** ^RETURN-VALUE:
  1095. X***************
  1096. X*** 915,921 ****
  1097. X  **    Both candidate and target should be non-null and non-empty.
  1098. X  **    target should be the ad_prompt field of an ARGDESC structure.
  1099. X  **
  1100. X! ** ^SIDE-EFECTS:
  1101. X  **    None.
  1102. X  **
  1103. X  ** ^RETURN-VALUE:
  1104. X--- 915,921 ----
  1105. X  **    Both candidate and target should be non-null and non-empty.
  1106. X  **    target should be the ad_prompt field of an ARGDESC structure.
  1107. X  **
  1108. X! ** ^SIDE-EFFECTS:
  1109. X  **    None.
  1110. X  **
  1111. X  ** ^RETURN-VALUE:
  1112. X***************
  1113. X*** 1035,1041 ****
  1114. X  **    path should be non-null, non-empty, and should correspond to a valid
  1115. X  **    pathname (absolute or relative).
  1116. X  **
  1117. X! ** ^SIDE-EFECTS:
  1118. X  **    None under Unix and AmigaDOS.
  1119. X  **
  1120. X  **    Under VMS, the file version is removed and any .COM or .EXE extension
  1121. X--- 1035,1041 ----
  1122. X  **    path should be non-null, non-empty, and should correspond to a valid
  1123. X  **    pathname (absolute or relative).
  1124. X  **
  1125. X! ** ^SIDE-EFFECTS:
  1126. X  **    None under Unix and AmigaDOS.
  1127. X  **
  1128. X  **    Under VMS, the file version is removed and any .COM or .EXE extension
  1129. X***************
  1130. X*** 1180,1186 ****
  1131. X  ** ^REQUIREMENTS:
  1132. X  **    maxcols and indent must be positive numbers with maxcols > indent
  1133. X  **
  1134. X! ** ^SIDE-EFECTS:
  1135. X  **    Output is printed to fp.
  1136. X  **
  1137. X  ** ^RETURN-VALUE:
  1138. X--- 1180,1186 ----
  1139. X  ** ^REQUIREMENTS:
  1140. X  **    maxcols and indent must be positive numbers with maxcols > indent
  1141. X  **
  1142. X! ** ^SIDE-EFFECTS:
  1143. X  **    Output is printed to fp.
  1144. X  **
  1145. X  ** ^RETURN-VALUE:
  1146. X*** syserr.c.OLD    Thu Aug 15 11:51:32 1991
  1147. X--- syserr.c    Thu Aug  1 15:46:29 1991
  1148. X***************
  1149. X*** 57,63 ****
  1150. X  ** ^REQUIREMENTS:
  1151. X  **    None.
  1152. X  **
  1153. X! ** ^SIDE-EFECTS:
  1154. X  **    Writes to stderr.
  1155. X  **
  1156. X  ** ^RETURN-VALUE:
  1157. X--- 57,63 ----
  1158. X  ** ^REQUIREMENTS:
  1159. X  **    None.
  1160. X  **
  1161. X! ** ^SIDE-EFFECTS:
  1162. X  **    Writes to stderr.
  1163. X  **
  1164. X  ** ^RETURN-VALUE:
  1165. X***************
  1166. X*** 115,121 ****
  1167. X  ** ^REQUIREMENTS:
  1168. X  **    No special requirements.
  1169. X  **
  1170. X! ** ^SIDE-EFECTS:
  1171. X  **    All output is written to stderr. Program execution is terminated.
  1172. X  **
  1173. X  ** ^RETURN-VALUE:
  1174. X--- 115,121 ----
  1175. X  ** ^REQUIREMENTS:
  1176. X  **    No special requirements.
  1177. X  **
  1178. X! ** ^SIDE-EFFECTS:
  1179. X  **    All output is written to stderr. Program execution is terminated.
  1180. X  **
  1181. X  ** ^RETURN-VALUE:
  1182. X***************
  1183. X*** 173,179 ****
  1184. X  ** ^REQUIREMENTS:
  1185. X  **    None.
  1186. X  **
  1187. X! ** ^SIDE-EFECTS:
  1188. X  **    Writes to stderr.
  1189. X  **
  1190. X  ** ^RETURN-VALUE:
  1191. X--- 173,179 ----
  1192. X  ** ^REQUIREMENTS:
  1193. X  **    None.
  1194. X  **
  1195. X! ** ^SIDE-EFFECTS:
  1196. X  **    Writes to stderr.
  1197. X  **
  1198. X  ** ^RETURN-VALUE:
  1199. X***************
  1200. X*** 224,230 ****
  1201. X  ** ^REQUIREMENTS:
  1202. X  **    No special requirements.
  1203. X  **
  1204. X! ** ^SIDE-EFECTS:
  1205. X  **    All output is written to stderr.  Errno is cleared.
  1206. X  **
  1207. X  ** ^RETURN-VALUE:
  1208. X--- 224,230 ----
  1209. X  ** ^REQUIREMENTS:
  1210. X  **    No special requirements.
  1211. X  **
  1212. X! ** ^SIDE-EFFECTS:
  1213. X  **    All output is written to stderr.  Errno is cleared.
  1214. X  **
  1215. X  ** ^RETURN-VALUE:
  1216. X*** test.rc.OLD    Thu Aug 15 11:51:57 1991
  1217. X--- test.rc    Thu Aug 15 11:01:23 1991
  1218. X***************
  1219. X*** 1,6 ****
  1220. X--- 1,10 ----
  1221. X  #!/bin/rc
  1222. X  #    test.rc - rc shell script to test out the parseargs command!
  1223. X  #
  1224. X+ #   NOTE: This script tests Byron Rakitzis' version of rc. NOT the
  1225. X+ #         Plan 9 version (there are a few differences such as the use
  1226. X+ #         of "else" instead of "if not" and the use of "$^variable").
  1227. X+ #
  1228. X  NAME=`{basename $0}
  1229. X  
  1230. X  ARGUMENTS='
  1231. X*** unix_args.c.OLD    Thu Aug 15 11:52:16 1991
  1232. X--- unix_args.c    Thu Aug  1 15:46:35 1991
  1233. X***************
  1234. X*** 86,92 ****
  1235. X  ** ^REQUIREMENTS:
  1236. X  **    The final element in argv must be a NULL pointer.
  1237. X  **
  1238. X! ** ^SIDE-EFECTS:
  1239. X  **    argd is modified according to the command-line description and parameters
  1240. X  **
  1241. X  ** ^RETURN-VALUE:
  1242. X--- 86,92 ----
  1243. X  ** ^REQUIREMENTS:
  1244. X  **    The final element in argv must be a NULL pointer.
  1245. X  **
  1246. X! ** ^SIDE-EFFECTS:
  1247. X  **    argd is modified according to the command-line description and parameters
  1248. X  **
  1249. X  ** ^RETURN-VALUE:
  1250. X***************
  1251. X*** 484,490 ****
  1252. X  **    buf must be large enough to hold the formatted result (100 characters
  1253. X  **    should do the trick).
  1254. X  **
  1255. X! ** ^SIDE-EFECTS:
  1256. X  **    buf is overwritten.
  1257. X  **
  1258. X  ** ^RETURN-VALUE:
  1259. X--- 484,490 ----
  1260. X  **    buf must be large enough to hold the formatted result (100 characters
  1261. X  **    should do the trick).
  1262. X  **
  1263. X! ** ^SIDE-EFFECTS:
  1264. X  **    buf is overwritten.
  1265. X  **
  1266. X  ** ^RETURN-VALUE:
  1267. X***************
  1268. X*** 574,580 ****
  1269. X  ** ^REQUIREMENTS:
  1270. X  **    argd should be a non-null command-line argument-descriptor array
  1271. X  **
  1272. X! ** ^SIDE-EFECTS:
  1273. X  **    Prints on stderr.
  1274. X  **
  1275. X  ** ^RETURN-VALUE:
  1276. X--- 574,580 ----
  1277. X  ** ^REQUIREMENTS:
  1278. X  **    argd should be a non-null command-line argument-descriptor array
  1279. X  **
  1280. X! ** ^SIDE-EFFECTS:
  1281. X  **    Prints on stderr.
  1282. X  **
  1283. X  ** ^RETURN-VALUE:
  1284. X*** unix_man.c.OLD    Thu Aug 15 11:52:23 1991
  1285. X--- unix_man.c    Thu Aug  1 15:46:44 1991
  1286. X***************
  1287. X*** 56,62 ****
  1288. X  **    buf must be large enough to hold the formatted result (100 characters
  1289. X  **    should do the trick).
  1290. X  **
  1291. X! ** ^SIDE-EFECTS:
  1292. X  **    buf is overwritten.
  1293. X  **
  1294. X  ** ^RETURN-VALUE:
  1295. X--- 56,62 ----
  1296. X  **    buf must be large enough to hold the formatted result (100 characters
  1297. X  **    should do the trick).
  1298. X  **
  1299. X! ** ^SIDE-EFFECTS:
  1300. X  **    buf is overwritten.
  1301. X  **
  1302. X  ** ^RETURN-VALUE:
  1303. X***************
  1304. X*** 144,150 ****
  1305. X  ** ^REQUIREMENTS:
  1306. X  **    Argd should be a valid command-line descriptor array.
  1307. X  **
  1308. X! ** ^SIDE-EFECTS:
  1309. X  **    Prints on standard-output.
  1310. X  **
  1311. X  ** ^RETURN-VALUE:
  1312. X--- 144,150 ----
  1313. X  ** ^REQUIREMENTS:
  1314. X  **    Argd should be a valid command-line descriptor array.
  1315. X  **
  1316. X! ** ^SIDE-EFFECTS:
  1317. X  **    Prints on standard-output.
  1318. X  **
  1319. X  ** ^RETURN-VALUE:
  1320. X*** vms_args.c.OLD    Thu Aug 15 11:52:36 1991
  1321. X--- vms_args.c    Thu Aug  1 15:47:00 1991
  1322. X***************
  1323. X*** 101,107 ****
  1324. X  ** ^REQUIREMENTS:
  1325. X  **    argv must be non-null
  1326. X  **
  1327. X! ** ^SIDE-EFECTS:
  1328. X  **    *result is assigned to either the concatenated argv string or the
  1329. X  **    original command-line. The result shoub be freed using free().
  1330. X  **
  1331. X--- 101,107 ----
  1332. X  ** ^REQUIREMENTS:
  1333. X  **    argv must be non-null
  1334. X  **
  1335. X! ** ^SIDE-EFFECTS:
  1336. X  **    *result is assigned to either the concatenated argv string or the
  1337. X  **    original command-line. The result shoub be freed using free().
  1338. X  **
  1339. X***************
  1340. X*** 193,199 ****
  1341. X  ** ^REQUIREMENTS:
  1342. X  **    <str> should be non-null and non-empty
  1343. X  **
  1344. X! ** ^SIDE-EFECTS:
  1345. X  **    <str> is "trimmed" to canonical form and special characters are mapped
  1346. X  **    to a unique code.
  1347. X  **
  1348. X--- 193,199 ----
  1349. X  ** ^REQUIREMENTS:
  1350. X  **    <str> should be non-null and non-empty
  1351. X  **
  1352. X! ** ^SIDE-EFFECTS:
  1353. X  **    <str> is "trimmed" to canonical form and special characters are mapped
  1354. X  **    to a unique code.
  1355. X  **
  1356. X***************
  1357. X*** 473,479 ****
  1358. X  **    <vp> must already be preprocessed by dcl_strxlat to escape any quoted
  1359. X  **    characters and to map special characters to their corresponding values.
  1360. X  **
  1361. X! ** ^SIDE-EFECTS:
  1362. X  **    Ad has some of its flags modified as well as any modifications that
  1363. X  **    are made by the ad_type function.
  1364. X  **
  1365. X--- 473,479 ----
  1366. X  **    <vp> must already be preprocessed by dcl_strxlat to escape any quoted
  1367. X  **    characters and to map special characters to their corresponding values.
  1368. X  **
  1369. X! ** ^SIDE-EFFECTS:
  1370. X  **    Ad has some of its flags modified as well as any modifications that
  1371. X  **    are made by the ad_type function.
  1372. X  **
  1373. X***************
  1374. X*** 551,557 ****
  1375. X  ** ^REQUIREMENTS:
  1376. X  **    The final element in argv must be a NULL pointer.
  1377. X  **
  1378. X! ** ^SIDE-EFECTS:
  1379. X  **    argd is modified according to the command-line description and parameters
  1380. X  **
  1381. X  ** ^RETURN-VALUE:
  1382. X--- 551,557 ----
  1383. X  ** ^REQUIREMENTS:
  1384. X  **    The final element in argv must be a NULL pointer.
  1385. X  **
  1386. X! ** ^SIDE-EFFECTS:
  1387. X  **    argd is modified according to the command-line description and parameters
  1388. X  **
  1389. X  ** ^RETURN-VALUE:
  1390. X***************
  1391. X*** 830,836 ****
  1392. X  **    buf must be large enough to hold the formatted result (100 characters
  1393. X  **    should do the trick).
  1394. X  **
  1395. X! ** ^SIDE-EFECTS:
  1396. X  **    buf is overwritten.
  1397. X  **
  1398. X  ** ^RETURN-VALUE:
  1399. X--- 830,836 ----
  1400. X  **    buf must be large enough to hold the formatted result (100 characters
  1401. X  **    should do the trick).
  1402. X  **
  1403. X! ** ^SIDE-EFFECTS:
  1404. X  **    buf is overwritten.
  1405. X  **
  1406. X  ** ^RETURN-VALUE:
  1407. X***************
  1408. X*** 900,906 ****
  1409. X  ** ^REQUIREMENTS:
  1410. X  **    argd should be a non-null command-line argument-descriptor array
  1411. X  **
  1412. X! ** ^SIDE-EFECTS:
  1413. X  **    Prints on stderr.
  1414. X  **
  1415. X  ** ^RETURN-VALUE:
  1416. X--- 900,906 ----
  1417. X  ** ^REQUIREMENTS:
  1418. X  **    argd should be a non-null command-line argument-descriptor array
  1419. X  **
  1420. X! ** ^SIDE-EFFECTS:
  1421. X  **    Prints on stderr.
  1422. X  **
  1423. X  ** ^RETURN-VALUE:
  1424. X*** xparse.c.OLD    Thu Aug 15 11:52:58 1991
  1425. X--- xparse.c    Thu Aug 15 11:20:40 1991
  1426. X***************
  1427. X*** 224,236 ****
  1428. X  
  1429. X  #ifdef vms_style
  1430. X  # ifdef vms
  1431. X!    { '<', ARGHIDDEN, argInput, __ &stdin,   "INPUT (redirect SYS$INPUT)" },
  1432. X!    { '>', ARGHIDDEN, argOutput, __ &stdout, "OUTPUT (redirect SYS$OUTPUT)" },
  1433. X!    { '%', ARGHIDDEN, argOutput, __ &stderr, "ERROR (redirect SYS$ERROR)" },
  1434. X  # else
  1435. X!    { '<', ARGHIDDEN, argInput, __ stdin,   "INPUT (redirect SYS$INPUT)" },
  1436. X!    { '>', ARGHIDDEN, argOutput, __ stdout, "OUTPUT (redirect SYS$OUTPUT)" },
  1437. X!    { '%', ARGHIDDEN, argOutput, __ stderr, "ERROR (redirect SYS$ERROR)" },
  1438. X  # endif
  1439. X  #endif
  1440. X  
  1441. X--- 224,236 ----
  1442. X  
  1443. X  #ifdef vms_style
  1444. X  # ifdef vms
  1445. X!    { '<', ARGHIDDEN, argInput, __ &stdin,   "sysINPUT (redirect SYS$INPUT)" },
  1446. X!    { '>', ARGHIDDEN, argOutput, __ &stdout, "sysOUTPUT (redirect SYS$OUTPUT)" },
  1447. X!    { '%', ARGHIDDEN, argOutput, __ &stderr, "sysERROR (redirect SYS$ERROR)" },
  1448. X  # else
  1449. X!    { '<', ARGHIDDEN, argInput, __ stdin,   "sysINPUT (redirect SYS$INPUT)" },
  1450. X!    { '>', ARGHIDDEN, argOutput, __ stdout, "sysOUTPUT (redirect SYS$OUTPUT)" },
  1451. X!    { '%', ARGHIDDEN, argOutput, __ stderr, "sysERROR (redirect SYS$ERROR)" },
  1452. X  # endif
  1453. X  #endif
  1454. X  
  1455. X***************
  1456. X*** 283,289 ****
  1457. X     ** ^REQUIREMENTS:
  1458. X     **    sym_name should correspond to the name of a pre-defined symbol.
  1459. X     **
  1460. X!    ** ^SIDE-EFECTS:
  1461. X     **    None.
  1462. X     **
  1463. X     ** ^RETURN-VALUE:
  1464. X--- 283,289 ----
  1465. X     ** ^REQUIREMENTS:
  1466. X     **    sym_name should correspond to the name of a pre-defined symbol.
  1467. X     **
  1468. X!    ** ^SIDE-EFFECTS:
  1469. X     **    None.
  1470. X     **
  1471. X     ** ^RETURN-VALUE:
  1472. X***************
  1473. X*** 344,350 ****
  1474. X  ** ^REQUIREMENTS:
  1475. X  **    Fd must correspond to a valid, open, file-descriptor.
  1476. X  **
  1477. X! ** ^SIDE-EFECTS:
  1478. X  **    None.
  1479. X  **
  1480. X  ** ^RETURN-VALUE:
  1481. X--- 344,350 ----
  1482. X  ** ^REQUIREMENTS:
  1483. X  **    Fd must correspond to a valid, open, file-descriptor.
  1484. X  **
  1485. X! ** ^SIDE-EFFECTS:
  1486. X  **    None.
  1487. X  **
  1488. X  ** ^RETURN-VALUE:
  1489. X***************
  1490. X*** 413,419 ****
  1491. X  ** ^REQUIREMENTS:
  1492. X  **    str should be non-null and non-empty
  1493. X  **
  1494. X! ** ^SIDE-EFECTS:
  1495. X  **    The characters which separated the two portions of <str> are
  1496. X  **    replaced with a single '\0'.
  1497. X  **
  1498. X--- 413,419 ----
  1499. X  ** ^REQUIREMENTS:
  1500. X  **    str should be non-null and non-empty
  1501. X  **
  1502. X! ** ^SIDE-EFFECTS:
  1503. X  **    The characters which separated the two portions of <str> are
  1504. X  **    replaced with a single '\0'.
  1505. X  **
  1506. X***************
  1507. X*** 497,503 ****
  1508. X  **    <argd> must point to an array that has been declared using the CMD_XXXX
  1509. X  **    macros, or using the ENDOFARGS (and optionally STARTOFARGS) macro.
  1510. X  **
  1511. X! ** ^SIDE-EFECTS:
  1512. X  **    The argd is initialized for use.
  1513. X  **
  1514. X  ** ^RETURN-VALUE:
  1515. X--- 497,503 ----
  1516. X  **    <argd> must point to an array that has been declared using the CMD_XXXX
  1517. X  **    macros, or using the ENDOFARGS (and optionally STARTOFARGS) macro.
  1518. X  **
  1519. X! ** ^SIDE-EFFECTS:
  1520. X  **    The argd is initialized for use.
  1521. X  **
  1522. X  ** ^RETURN-VALUE:
  1523. X***************
  1524. X*** 642,648 ****
  1525. X  **    <argd> must point to an array that has been declared using the CMD_XXXX
  1526. X  **    macros, or using the ENDOFARGS (and optionally STARTOFARGS) macro.
  1527. X  **
  1528. X! ** ^SIDE-EFECTS:
  1529. X  **    resets the ARG flags of each argument and the command-state of argd.
  1530. X  **
  1531. X  ** ^RETURN-VALUE:
  1532. X--- 642,648 ----
  1533. X  **    <argd> must point to an array that has been declared using the CMD_XXXX
  1534. X  **    macros, or using the ENDOFARGS (and optionally STARTOFARGS) macro.
  1535. X  **
  1536. X! ** ^SIDE-EFFECTS:
  1537. X  **    resets the ARG flags of each argument and the command-state of argd.
  1538. X  **
  1539. X  ** ^RETURN-VALUE:
  1540. X***************
  1541. X*** 723,729 ****
  1542. X  ** ^REQUIREMENTS:
  1543. X  **    Only the first 255 characters of user input is used.
  1544. X  **
  1545. X! ** ^SIDE-EFECTS:
  1546. X  **    Modifies <ad> accordingly.
  1547. X  **
  1548. X  ** ^RETURN-VALUE:
  1549. X--- 723,729 ----
  1550. X  ** ^REQUIREMENTS:
  1551. X  **    Only the first 255 characters of user input is used.
  1552. X  **
  1553. X! ** ^SIDE-EFFECTS:
  1554. X  **    Modifies <ad> accordingly.
  1555. X  **
  1556. X  ** ^RETURN-VALUE:
  1557. X***************
  1558. X*** 828,834 ****
  1559. X  **    parse_status should be a pointer to the result of a previous call to
  1560. X  **    {f,l,s,v,}parseargs.
  1561. X  **
  1562. X! ** ^SIDE-EFECTS:
  1563. X  **    The arg-descs for missing arguments may be modified by prompt_user.
  1564. X  **    parse_status will be modified to indicate whether or not a syntax
  1565. X  **    error really has occurred (it will be pe_SUCCESS if all is hunky-dory).
  1566. X--- 828,834 ----
  1567. X  **    parse_status should be a pointer to the result of a previous call to
  1568. X  **    {f,l,s,v,}parseargs.
  1569. X  **
  1570. X! ** ^SIDE-EFFECTS:
  1571. X  **    The arg-descs for missing arguments may be modified by prompt_user.
  1572. X  **    parse_status will be modified to indicate whether or not a syntax
  1573. X  **    error really has occurred (it will be pe_SUCCESS if all is hunky-dory).
  1574. X***************
  1575. X*** 943,949 ****
  1576. X  **    by preceding it with one of '!', '^', or '~'. Tokens must be separated by
  1577. X  **    one or more non-alphanumerics (other than '!', '~', and '^').
  1578. X  **
  1579. X! ** ^SIDE-EFECTS:
  1580. X  **    None.
  1581. X  **
  1582. X  ** ^RETURN-VALUE:
  1583. X--- 943,949 ----
  1584. X  **    by preceding it with one of '!', '^', or '~'. Tokens must be separated by
  1585. X  **    one or more non-alphanumerics (other than '!', '~', and '^').
  1586. X  **
  1587. X! ** ^SIDE-EFFECTS:
  1588. X  **    None.
  1589. X  **
  1590. X  ** ^RETURN-VALUE:
  1591. X***************
  1592. X*** 1088,1094 ****
  1593. X  **    <cmd> must point to an array that has been declared using the CMD_XXXX
  1594. X  **    macros, or using the ENDOFARGS (and optionally STARTOFARGS) macro.
  1595. X  **
  1596. X! ** ^SIDE-EFECTS:
  1597. X  **    None.
  1598. X  **
  1599. X  ** ^RETURN-VALUE:
  1600. X--- 1088,1094 ----
  1601. X  **    <cmd> must point to an array that has been declared using the CMD_XXXX
  1602. X  **    macros, or using the ENDOFARGS (and optionally STARTOFARGS) macro.
  1603. X  **
  1604. X! ** ^SIDE-EFFECTS:
  1605. X  **    None.
  1606. X  **
  1607. X  ** ^RETURN-VALUE:
  1608. X***************
  1609. X*** 1228,1234 ****
  1610. X  **    <cmd> must point to an array that has been declared using the CMD_XXXX
  1611. X  **    macros, or using the ENDOFARGS (and optionally STARTOFARGS) macro.
  1612. X  **
  1613. X! ** ^SIDE-EFECTS:
  1614. X  **    Modifies the parse-flags of <cmd> is $PARSECNTL is non-null & non-empty.
  1615. X  **
  1616. X  ** ^RETURN-VALUE:
  1617. X--- 1228,1234 ----
  1618. X  **    <cmd> must point to an array that has been declared using the CMD_XXXX
  1619. X  **    macros, or using the ENDOFARGS (and optionally STARTOFARGS) macro.
  1620. X  **
  1621. X! ** ^SIDE-EFFECTS:
  1622. X  **    Modifies the parse-flags of <cmd> is $PARSECNTL is non-null & non-empty.
  1623. X  **
  1624. X  ** ^RETURN-VALUE:
  1625. X***************
  1626. X*** 1339,1345 ****
  1627. X  **    <cmd> should be an array of ARGDESCs declared using the CMD_XXXX macros
  1628. X  **    or with the ENDOFARGS (and possible STARTOFARGS) macros.
  1629. X  **
  1630. X! ** ^SIDE-EFECTS:
  1631. X  **    Any matched arguments have their ARGDESCs modified accordingly.
  1632. X  **    Also, the command-state is changed to reflect the fact that the
  1633. X  **    environment variable has been parsed. Also, after parsing the
  1634. X--- 1339,1345 ----
  1635. X  **    <cmd> should be an array of ARGDESCs declared using the CMD_XXXX macros
  1636. X  **    or with the ENDOFARGS (and possible STARTOFARGS) macros.
  1637. X  **
  1638. X! ** ^SIDE-EFFECTS:
  1639. X  **    Any matched arguments have their ARGDESCs modified accordingly.
  1640. X  **    Also, the command-state is changed to reflect the fact that the
  1641. X  **    environment variable has been parsed. Also, after parsing the
  1642. X***************
  1643. X*** 1375,1385 ****
  1644. X--- 1375,1390 ----
  1645. X  
  1646. X     if ( !CMD_isINIT(cmd) )  init_args( cmd );
  1647. X  
  1648. X+       /* if ignoring the <CMD>_ARGS variable then just return */
  1649. X     if ( BTEST(cmd_state(cmd), ps_NOCMDENV) )  return;
  1650. X  
  1651. X+       /* build the name of the environment variable */
  1652. X     strucpy( env_name, ProgName );
  1653. X     strcat( env_name, ENV_SUFFIX );
  1654. X  
  1655. X+       /* get the value of the environment variable,
  1656. X+       ** split it up into tokens, and parse it.
  1657. X+       */
  1658. X     env_args = getenv(env_name);
  1659. X     if ( env_args ) {
  1660. X        char **argv = (char **)NULL;
  1661. X***************
  1662. X*** 1402,1407 ****
  1663. X--- 1407,1413 ----
  1664. X        cmd_prev(cmd) = ARGDESCNULL;
  1665. X  #endif
  1666. X  
  1667. X+          /* check for errors */
  1668. X        if ( rc  &&  !BTEST(cmd_flags(cmd), pa_IGNORE) ) {
  1669. X           eprintf( "%s: syntax-error in %s \"%s\".\n",
  1670. X                    ProgName, USER_VARIABLE, env_name );
  1671. X***************
  1672. X*** 1444,1450 ****
  1673. X  **    <argdp> should point to an array of ARGDESCs declared using the CMD_XXXX
  1674. X  **    macros or with the ENDOFARGS (and possible STARTOFARGS) macros.
  1675. X  **
  1676. X! ** ^SIDE-EFECTS:
  1677. X  **      Initialize argd and parses any default arguments.
  1678. X  **
  1679. X  ** ^RETURN-VALUE:
  1680. X--- 1450,1456 ----
  1681. X  **    <argdp> should point to an array of ARGDESCs declared using the CMD_XXXX
  1682. X  **    macros or with the ENDOFARGS (and possible STARTOFARGS) macros.
  1683. X  **
  1684. X! ** ^SIDE-EFFECTS:
  1685. X  **      Initialize argd and parses any default arguments.
  1686. X  **
  1687. X  ** ^RETURN-VALUE:
  1688. X***************
  1689. X*** 1526,1532 ****
  1690. X  **    <argd> should be an array of ARGDESCs declared using the CMD_XXXX macros
  1691. X  **    or with the ENDOFARGS (and possible STARTOFARGS) macros.
  1692. X  **
  1693. X! ** ^SIDE-EFECTS:
  1694. X  **    Prints on stderr.
  1695. X  **
  1696. X  ** ^RETURN-VALUE:
  1697. X--- 1532,1538 ----
  1698. X  **    <argd> should be an array of ARGDESCs declared using the CMD_XXXX macros
  1699. X  **    or with the ENDOFARGS (and possible STARTOFARGS) macros.
  1700. X  **
  1701. X! ** ^SIDE-EFFECTS:
  1702. X  **    Prints on stderr.
  1703. X  **
  1704. X  ** ^RETURN-VALUE:
  1705. X***************
  1706. X*** 1615,1621 ****
  1707. X  **    If mode is READ or READ+WRITE then the last argument should be the
  1708. X  **    address of the desired object, otherwise it should be the object itself.
  1709. X  **
  1710. X! ** ^SIDE-EFECTS:
  1711. X  **    None if the mode is READ, otherwise, the desired attibutes are (re)set
  1712. X  **
  1713. X  ** ^RETURN-VALUE:
  1714. X--- 1621,1627 ----
  1715. X  **    If mode is READ or READ+WRITE then the last argument should be the
  1716. X  **    address of the desired object, otherwise it should be the object itself.
  1717. X  **
  1718. X! ** ^SIDE-EFFECTS:
  1719. X  **    None if the mode is READ, otherwise, the desired attibutes are (re)set
  1720. X  **
  1721. X  ** ^RETURN-VALUE:
  1722. X***************
  1723. X*** 1690,1696 ****
  1724. X  
  1725. X        /* now figure out what to do and go do it! */
  1726. X     switch( cntl ) {
  1727. X!       case  pc_ARGFLAGS :
  1728. X           {
  1729. X              register ARGDESC *ad, *args;
  1730. X              char *name = VA_ARG( ap, char * );
  1731. X--- 1696,1702 ----
  1732. X  
  1733. X        /* now figure out what to do and go do it! */
  1734. X     switch( cntl ) {
  1735. X!       case  pc_ARGFLAGS :  /* get/set arg-flags */
  1736. X           {
  1737. X              register ARGDESC *ad, *args;
  1738. X              char *name = VA_ARG( ap, char * );
  1739. X***************
  1740. X*** 1697,1702 ****
  1741. X--- 1703,1709 ----
  1742. X              int  *argflags;
  1743. X              BOOL  is_match = FALSE;
  1744. X  
  1745. X+                /* first we have to find the argument whose flags we need */
  1746. X              for (args = argd ; args  &&  !is_match ; args = cmd_defargs(args)) {
  1747. X                 for (ad = ARG_FIRST(args) ; !ARG_isEND(ad) ; ARG_ADVANCE(ad)) {
  1748. X                    if ( arg_type(ad) == argDummy )  continue;
  1749. X***************
  1750. X*** 1713,1718 ****
  1751. X--- 1720,1726 ----
  1752. X                 return  pe_NOMATCH;
  1753. X              }
  1754. X  
  1755. X+                /* now that we found it - retrieve the argument flags */
  1756. X              if ( isREADING(mode) ) {
  1757. X                argflags = VA_ARG( ap, int * );
  1758. X                *argflags = (int) arg_flags(ad);
  1759. X***************
  1760. X*** 1723,1732 ****
  1761. X           }/*block*/
  1762. X           break;
  1763. X  
  1764. X!       case  pc_PARSEFLAGS :
  1765. X           {
  1766. X              int *pflags, flags;
  1767. X  
  1768. X              if ( isREADING(mode) ) {
  1769. X                pflags = VA_ARG( ap, int * );
  1770. X                flags = (int) cmd_flags(cmd);
  1771. X--- 1731,1741 ----
  1772. X           }/*block*/
  1773. X           break;
  1774. X  
  1775. X!       case  pc_PARSEFLAGS : /* get/set the parse-flags */
  1776. X           {
  1777. X              int *pflags, flags;
  1778. X  
  1779. X+                /* get value from call-stack (dependent on the mode) */
  1780. X              if ( isREADING(mode) ) {
  1781. X                pflags = VA_ARG( ap, int * );
  1782. X                flags = (int) cmd_flags(cmd);
  1783. X***************
  1784. X*** 1736,1750 ****
  1785. X                pflags = &flags;
  1786. X              }
  1787. X  
  1788. X              if ( isWRITING(mode) )  cmd_flags(cmd) = (argMask_t) *pflags;
  1789. X              if ( isREADING(mode) )  *pflags = flags;
  1790. X           }/*block*/
  1791. X           break;
  1792. X  
  1793. X!       case  pc_DEFARGS :
  1794. X           {
  1795. X              ARGDESC **pdefargd, *defargd;
  1796. X  
  1797. X              if ( isREADING(mode) ) {
  1798. X                 pdefargd = VA_ARG( ap, ARGDESC ** );
  1799. X                 defargd = cmd_defargs(cmd);
  1800. X--- 1745,1761 ----
  1801. X                pflags = &flags;
  1802. X              }
  1803. X  
  1804. X+                /* perform the desired action(s) */
  1805. X              if ( isWRITING(mode) )  cmd_flags(cmd) = (argMask_t) *pflags;
  1806. X              if ( isREADING(mode) )  *pflags = flags;
  1807. X           }/*block*/
  1808. X           break;
  1809. X  
  1810. X!       case  pc_DEFARGS : /* get/set the default arguments */
  1811. X           {
  1812. X              ARGDESC **pdefargd, *defargd;
  1813. X  
  1814. X+                /* get value from call-stack (dependent on the mode) */
  1815. X              if ( isREADING(mode) ) {
  1816. X                 pdefargd = VA_ARG( ap, ARGDESC ** );
  1817. X                 defargd = cmd_defargs(cmd);
  1818. X***************
  1819. X*** 1773,1784 ****
  1820. X           }
  1821. X           break;
  1822. X  
  1823. X!       case  pc_NAME :
  1824. X!       case  pc_PURPOSE :
  1825. X!       case  pc_DESCRIPTION :
  1826. X           {
  1827. X              CONST char *str, **pstr;
  1828. X  
  1829. X              if ( isREADING(mode) ) {
  1830. X                 pstr = VA_ARG( ap, CONST char ** );
  1831. X                 if      ( cntl == pc_NAME )        str = cmd_name(cmd);
  1832. X--- 1784,1796 ----
  1833. X           }
  1834. X           break;
  1835. X  
  1836. X!       case  pc_NAME :  /* get/set name */
  1837. X!       case  pc_PURPOSE :  /* get/set purpose */
  1838. X!       case  pc_DESCRIPTION :  /* get/set description */
  1839. X           {
  1840. X              CONST char *str, **pstr;
  1841. X  
  1842. X+                /* get value from call-stack (dependent on the mode) */
  1843. X              if ( isREADING(mode) ) {
  1844. X                 pstr = VA_ARG( ap, CONST char ** );
  1845. X                 if      ( cntl == pc_NAME )        str = cmd_name(cmd);
  1846. X***************
  1847. X*** 1790,1795 ****
  1848. X--- 1802,1808 ----
  1849. X                 pstr = &str;
  1850. X              }
  1851. X  
  1852. X+                /* perform the desired action(s) */
  1853. X              if ( isWRITING(mode) )  {
  1854. X                 if      ( cntl == pc_NAME )        cmd_name(cmd) = *pstr;
  1855. X                 else if ( cntl == pc_PURPOSE )     cmd_purpose(cmd) = *pstr;
  1856. X***************
  1857. X*** 1843,1849 ****
  1858. X  ** ^REQUIREMENTS:
  1859. X  **    <str> should be non-NULL and non-empty
  1860. X  **
  1861. X! ** ^SIDE-EFECTS:
  1862. X  **    <str> is modified by strsplit().
  1863. X  **    <argd> is modified accordingly as arguments are matched.
  1864. X  **
  1865. X--- 1856,1862 ----
  1866. X  ** ^REQUIREMENTS:
  1867. X  **    <str> should be non-NULL and non-empty
  1868. X  **
  1869. X! ** ^SIDE-EFFECTS:
  1870. X  **    <str> is modified by strsplit().
  1871. X  **    <argd> is modified accordingly as arguments are matched.
  1872. X  **
  1873. X***************
  1874. X*** 1937,1943 ****
  1875. X  ** ^REQUIREMENTS:
  1876. X  **    <fp> should be non-NULL, already opened-for-reading, file-pointer
  1877. X  **
  1878. X! ** ^SIDE-EFECTS:
  1879. X  **    <argd> is modified accordingly as arguments are matched.
  1880. X  **
  1881. X  ** ^RETURN-VALUE:
  1882. X--- 1950,1956 ----
  1883. X  ** ^REQUIREMENTS:
  1884. X  **    <fp> should be non-NULL, already opened-for-reading, file-pointer
  1885. X  **
  1886. X! ** ^SIDE-EFFECTS:
  1887. X  **    <argd> is modified accordingly as arguments are matched.
  1888. X  **
  1889. X  ** ^RETURN-VALUE:
  1890. X***************
  1891. X*** 2069,2075 ****
  1892. X  ** ^REQUIREMENTS:
  1893. X  **    <argls> should be an ArgList of strings
  1894. X  **
  1895. X! ** ^SIDE-EFECTS:
  1896. X  **    <argd> is modified accordingly as arguments are matched.
  1897. X  **
  1898. X  ** ^RETURN-VALUE:
  1899. X--- 2082,2088 ----
  1900. X  ** ^REQUIREMENTS:
  1901. X  **    <argls> should be an ArgList of strings
  1902. X  **
  1903. X! ** ^SIDE-EFFECTS:
  1904. X  **    <argd> is modified accordingly as arguments are matched.
  1905. X  **
  1906. X  ** ^RETURN-VALUE:
  1907. X***************
  1908. X*** 2118,2126 ****
  1909. X--- 2131,2141 ----
  1910. X        argv[i] = L_STRING(ls);
  1911. X     }
  1912. X  
  1913. X+       /* parse the list */
  1914. X     saveflags = cmd_flags(argd);
  1915. X     BSET(cmd_flags(argd), pa_ARGV0);
  1916. X     rc = parse_argv_style( argv, parse_init( &argd ) );
  1917. X+    free( argv );
  1918. X  
  1919. X        /* scan for missing required arguments */
  1920. X     if ( SYNTAX_ERROR(rc, argd) ) {
  1921. X***************
  1922. X*** 2174,2180 ****
  1923. X  **    the last argument would appear, then the NULL pointer will end the
  1924. X  **    the list of arguments and argc is ignored.
  1925. X  **    
  1926. X! ** ^SIDE-EFECTS:
  1927. X  **    <argd> is modified accordingly as arguments are matched.
  1928. X  **
  1929. X  ** ^RETURN-VALUE:
  1930. X--- 2189,2195 ----
  1931. X  **    the last argument would appear, then the NULL pointer will end the
  1932. X  **    the list of arguments and argc is ignored.
  1933. X  **    
  1934. X! ** ^SIDE-EFFECTS:
  1935. X  **    <argd> is modified accordingly as arguments are matched.
  1936. X  **
  1937. X  ** ^RETURN-VALUE:
  1938. X***************
  1939. X*** 2217,2222 ****
  1940. X--- 2232,2238 ----
  1941. X     if ( !argv )  return  pe_SYSTEM;
  1942. X     argv[ argc ] = CHARNULL;
  1943. X  
  1944. X+       /* assign the string into the array */
  1945. X     VA_START(ap, argc);
  1946. X     for ( i = 0; i < argc  &&  (arg = VA_ARG(ap, char *)) ; i++ ) {
  1947. X        argv[i] = arg;
  1948. X***************
  1949. X*** 2223,2229 ****
  1950. X--- 2239,2247 ----
  1951. X     }
  1952. X     VA_END(ap);
  1953. X  
  1954. X+       /* parse the arguments */
  1955. X     rc = parse_argv_style( argv, parse_init( &argd ) );
  1956. X+    free( argv );
  1957. X  
  1958. X        /* scan for missing required arguments */
  1959. X     if ( SYNTAX_ERROR(rc, argd) ) {
  1960. X***************
  1961. X*** 2267,2273 ****
  1962. X  ** ^REQUIREMENTS:
  1963. X  **    <argv> must be non-NULL and have a NULL pointer as its last item.
  1964. X  **
  1965. X! ** ^SIDE-EFECTS:
  1966. X  **    <argd> is modified accordingly as arguments are matched.
  1967. X  **
  1968. X  ** ^RETURN-VALUE:
  1969. X--- 2285,2291 ----
  1970. X  ** ^REQUIREMENTS:
  1971. X  **    <argv> must be non-NULL and have a NULL pointer as its last item.
  1972. X  **
  1973. X! ** ^SIDE-EFFECTS:
  1974. X  **    <argd> is modified accordingly as arguments are matched.
  1975. X  **
  1976. X  ** ^RETURN-VALUE:
  1977. END_OF_FILE
  1978. if test 54518 -ne `wc -c <'PATCH08'`; then
  1979.     echo shar: \"'PATCH08'\" unpacked with wrong size!
  1980. fi
  1981. # end of 'PATCH08'
  1982. fi
  1983. echo shar: End of shell archive.
  1984. exit 0
  1985.  
  1986. exit 0 # Just in case...
  1987. -- 
  1988. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1989. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1990. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1991. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1992.